'use strict';function _Ag(b){if("BODY"==b.tagName)return null;for(;(b=$(b).css("position").in("static","relative")?b.parentElement:b.offsetParent)&&"BODY"!=b.tagName&&"visible"==$(b).css("overflow"););return b}
function _4i(b){let a=b.getBoundingClientRect().sc();for(;b=_Ag(b);){let q=b.getBoundingClientRect();a.left=Math.max(a.left,q.left);a.top=Math.max(a.top,q.top);a.right=Math.min(a.right,q.right);a.bottom=Math.min(a.bottom,q.bottom)}a={x:a.left,y:a.top,w:a.right-a.left,h:a.bottom-a.top};return 0<a.w&&0<a.h?a:null}
function _ct(b,a,q,r){function v(f,l,m,n,g,H,E,e,x=""){var z={w:window.innerWidth-11,h:window.innerHeight-11};d.attr("side",e);d.css({top:0,left:0});e=d[0].getBoundingClientRect();e={w:e.width,h:e.height};h[g]=e[g]-z[g];var t=+f?k[l]+k[n]+e[n]-z[n]:e[n]-k[l];h[l]=Math.min(h[l],t);if(0<h[g])return!0;if(0<t)if(u&&t<=h[l]&&h[l]/k[n]<=h[m]/k[g])var y=(+f?-1:1)*t;else return!0;e[g]>k[g]&&x.in("(",")")&&(x="");e[m]=x.in(">",")")?k[m]+k[g]-e[g]:x.in("<","(")?k[m]:k[m]+k[g]/2-e[g]/2;t=Math.max(0,e[m]+e[g]-
z[g]);var A=Math.max(0,-e[m]+3),F=Math.max(t,A),B=(z=$(">tail",d)[0])?z.getBoundingClientRect()[{w:"width",h:"height"}[g]]:0;let I=d.is("floatbox")?$(">cont",d):d,G=+I.css("borderRadius").match(/\d+/);0<e.h&&40>e.h&&G>e.h/4&&I.css("borderRadius",G=e.h/4);x=(x?e[g]:e[g]/2)-G-B/2;F-=x;if(0<F)if(B=(B-2*F)/(1.45*Math.sqrt(2))|0,6<=B)d.css("--tailSize",B+"px");else return!0;t=A-t;f=k[l]+(+f?k[n]:-e[n])+(y||0)-c[H];n=e[m]+t-c[E];y=d[0].prevPos||{};A=y[m]+y[g]/2-(n+e[g]/2);!r&&f==y[l]&&1<Math.abs(A)&&e[g]==
y[g]&&Math.abs(t+A)<x&&(n=y[m],t+=A);$(z).removeAttr("style").css(E,`calc(50% - ${t}px)`);d.css(E,n).css(H,f);d[0].prevPos={[l]:f,[m]:n,[g]:e[g]}}var d=$(b);b=d[0].offsetParent;"absolute"==d.css("position")&&"BODY"==b.tagName&&"static"==$(b).css("position")&&(b=b.parentElement);let c={top:0,left:0};b&&(c.add(b.getBoundingClientRect().sc()),c.top+=b.clientTop,c.left+=b.clientLeft);let k=a instanceof HTMLElement?_4i(a):a;if(k){a={l:"0,x,y,w,h,left,top",r:"1,x,y,w,h,left,top",t:"0,y,x,h,w,top,left",
b:"1,y,x,h,w,top,left"};var h={},u=!1,C=d.hasClass("noTail"),p=d.is("floatbox")?$("> cont > *",d):d,D=(f,l,m)=>{if(m){m="width"==f?"height":"width";var n=p["outer"+m.caplze()]()/p["outer"+f.caplze()]();n*=l;0<n&&p.css(m,p["outer"+m.caplze()]()-n)}0<l&&p.css(f,p["outer"+f.caplze()]()-l)},w={rr:()=>{p.css({width:"",height:""})},vr1:f=>{D("height",h.h,f)},vr2:f=>{D("height",h.y,f)},hr1:f=>{D("width",h.w,f)},hr2:f=>{D("width",h.x,f)},br1:()=>{w.hr1();w.vr1()},br2:()=>{h.y/p.outerHeight()>h.x/p.outerWidth()?
w.hr2():w.vr2()},pr1:()=>{h.h/p.outerHeight()<h.w/p.outerWidth()?w.hr1(1):w.vr1(1)},pr2:()=>{h.y/p.outerHeight()>h.x/p.outerWidth()?w.hr2(1):w.vr2(1)},ao1:()=>{d.addClass("noTail")},ao2:()=>u=!0,ao3:()=>{C||d.removeClass("noTail");u=!1}};q=q.toLowerCase().trim().split(/\s+/);q[1]=(q[1]||"").replace(/vr/g,"vr1,vr2").replace(/hr/g,"hr1,hr2").replace(/br/g,"br1,br2,br2").replace(/pr/g,"pr1,pr2").replace(/ao/g,"ao1,ao2,ao3").split(",");b=$(">resizeDetector",d).hide();a:for(let f of q[1]){f&&(w[f]()||
(h={x:Infinity,y:Infinity}));for(let l of q[0].split(/(?![<>()])/))if(!v(...a[l[0]].split(","),l[0],l[1])){var J=l[0];break a}}b.show();return J}}
function _Jh(b,a,q,r,v,d){a=$(a)[0];if(a.cancelNextPopup&&200>+new Date-a.cancelNextPopup)delete a.cancelNextPopup;else{"function"==typeof b&&(b=b());var c=$(b);if(r){r=$("<floatbox popupCntr><cont></cont><tail></tail><close></close></floatbox>").addClass(r);document.contains(c[0])&&!c[0].closest("hiddenDoc")&&r.insertAfter(c);r.find(">cont").append(c);if(v){if("auto-detect"==v){document.contains(r[0])||r.appendTo("hiddenDoc");v=c.css("backgroundColor");var k=c.css("borderColor")}r.css("--bgColor",
v);k||(v=_ma([v]),150<.299*v.r+.587*v.g+.114*v.b&&(k="rgba(0,0,0,0.5)"));k&&r.css("--bdrColor",k)}r[0].close=function(){$("> cont > *",this).triggerEvt("close");this.remove()};c=r.on("close",function(){this.close()}).on("click",">close",function(){this.close()})}!1!==d&&c.css({visibility:"hidden",opacity:0});c.prop({popupTriggerElem:a}).offOn("close.popupAround",function(){$(this.popupTriggerElem).removeClass("popup")});a.popupElem=c[0];document.contains(c[0])&&!c.closest("hiddenDoc")[0]||c.appendTo($(a).closest("[popupCntr]")[0]||
$("body"));"static"==c.css("position")&&c.css("position","absolute");$(b).triggerEvt("DOMInserted",!1,!0);_I(c.show());var h=(u,C,p)=>{if($(u).is(":visible"))return _ct(u,C,q,p)};return _nd(function*(){$(b)[0].onInitDone&&(yield $(b)[0].onInitDone.asyncFunc,yield u=>_Bd(u));if(h(c,a))return c.enableResizeEvent().offOn("resize.popupElem",function(u,C){h(this,this.popupTriggerElem,C)}),c.is("[noPopupAround], floatbox:has(> cont > [noPopupAround])")||$(a).addClass("popup"),$(a).offOn("resize.aroundElem",
function(){document.contains(this.popupElem)?h(this.popupElem,this):$(this).off(".aroundElem")}),!1!==d&&(d=d||"transformAndOpacity",c.removeClass(d),setTimeout(()=>{let u=c.attr("side");c.css({visibility:"",transformOrigin:u.in("b","r")?"0 0":"100% 100%",transform:"scale"+(u.in("l","r")?"X":"Y")+"(0)"});_Bd(()=>c.addClass(d).css({opacity:"",transform:""}))})),c[0];c.triggerEvt("focusLost close")})}};
